<?php
/**
 * 控制器公共类(基础类)文件
 */

namespace app\index\controller;

use think\Controller;
use think\Request;
use app\admin\model\Category as CategoryModel;

/**
 * 控制器基础类
 *
 * @category index
 * @package  Controller
 * @author   huwhois <huwhois@163.com>
 */

class Base extends Controller
{
    protected $category_model;
    protected $categories;

    public function __construct(Request $request = null)
    {
        parent::__construct($request);

        $this->category_model = new CategoryModel();

        $this->categories = obj_tree($this->category_model->field('id, pid, name, tablename, onclick')->where('is_del', 0)->select());

        $this->assign('categories', $this->categories);
    }
}
